#!/bin/bash

ll(){
        ls -alF --color -h "$1"
}

arch="amd64"
if uname -a | grep -i x86_64;then
        arch="amd64"
elif uname -a | grep -i arm64;then
        arch="arm64"
elif uname -a | grep -i aarch64;then
        arch="arm64"
fi


bin="/tmp/go.main_linux_${arch}"
dst="./main_linux_v3"
image="inthbl/tvbox_server_v3"

ll "$bin"
echo "[I] sudo mv $bin -> $dst"
sudo mv "$bin" "$dst"

ll .



if [ -z "$1" ];then
        sudo docker build -t "$image" .
        exit 0
fi


# sudo docker run --rm -p 9968:9968 testapi



echo "[I] buildand run"
sudo ./build.sh && sudo docker compose up -d  && sudo docker compose logs -f





#// CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o main_linux_arm64 *.go
#// CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main_linux_amd64 *.go

